//
//  JuSubOjc.swift
//  JuSwift
//
//  Created by Juvid on 2018/5/8.
//  Copyright © 2018年 Juvid. All rights reserved.
//

import UIKit

class JuSubOjc: JuSupOjc {

    func juCheckType()  {

//        let types  = [Movie(name: "电影"),Song(name: "歌曲")]
//        for item in types{
//            if let movie = item as? Movie{
//                print("电影\(movie)")
//            }else if item is Song{
//                print("歌曲")
//            }
//        }
        let someObjects  = ["zhutianwei",5432] as [Any]
        for object in someObjects{
            if let juObj = object as? Int{
//                可选转换
                print("整数\(juObj)")
            }else if object is String{
//                判断是否该类型
                print("字符")
            }
        }
         let movies: [AnyObject] = [Movie(name: "电影1"),Movie(name: "电影2")]


        for movie in movies as! [Movie]{
            print("电影\(String(describing: movie.name))")
        }
    }
}
class Movie: JuSupOjc {

}
class Song: JuSupOjc {

}

